import request from '@/utils/request.js'


export let axioslink = () => {
    return request({
        url: '/api/banner/list',
        method: 'GET',

    })
}
export let axioslink1 = () => {
    return request({
        url: '/api/pro/seckilllist',
        method: 'GET',

    })
}
export let axioslink2 = (val) => {
    return request({
        url: '/api/pro/list',
        method: 'GET',
        params: {
            count: val
        
        }
    })
}
export let fun_categorylist = () => {
    return request({
        url: '/api/pro/categorylist',
        method: 'GET',

    })
}
export let fun_categorybrandlist = (category) => {
    return request({
        url: '/api/pro/categorybrandlist',
        method: 'GET',
        params: {
            category: category
        }
    })
}
export let fun_prodetail = (proid) => {
    return request({
        url: `/api/pro/detail/${proid}`,
        method: 'GET',

    })
}
export let fun_sendcode = (tel) => {
    return request({
        url: '/api/user/dosendmsgcode',
        method: 'POST',
        data:{
            tel:tel
        }
    })
}
export let fun_checkPhone = (tel) => {
    return request({
        url: '/api/user/docheckphone',
        method: 'POST',
        data:{
            tel:tel
        }
    })
}
export let fun_login = (username,password) => {
    return request({
        url: '/api/user/login',
        method: 'POST',
        data:{
            loginname:username,
            password:password
        }
    })
}
export let fun_search = (keyword) => {
    return request({
        url: "/api/pro/search",
        method: 'GET',
        params:{   
            keyword:keyword
        }

    })
}
export let fun_hotsearch = () => {
    return request({
        url: "/api/pro/hotword",
        method: 'GET',
    })
}
export let fun_categorybrandprolist = (category,brand) => {
    return request({
        url: '/api/pro/categorybrandprolist',
        method: 'GET',
        params: {
            category: category,
            brand:brand
        }
    })
}
export let fun_userinfo = (userid) => {
    return request({
        url: "/api/user/info",
        method: 'GET',
        params:{
            userid
        }
    })
}
// 加入购物车
export let fun_addcart = (userid,proid,num) => {
    return request({
        url: "/api/cart/add",
        method: 'POST',
        data:{
            userid,
            proid,
            num
        }
    })
}
// 查看购物车
export let fun_lookcart = (userid) => {
    return request({
        url: "/api/cart/list",
        method: 'POST',
        data:{
            userid,      
        }
    })
}
// 删除购物车商品
export let fun_delcart = (cartid) => {
    return request({
        url: "/api/cart/remove",
        method: 'POST',
        data:{
            cartid,      
        }
    })
}

